const imageBaseUrl = import.meta.env.VITE_BASE_URL + 'upload/'

import menus from './menus'

export default {
  appkey: import.meta.env.VITE_APPKEY,

  SYS_USER: 'sys-user',
  SYS_TOKEN: 'sys-token',
  SYS_EXPIRES: 'sys-expires',
  tokenHead: 'Bearer ',

  logoPath: '',
  title: '在线学习平台-后台管理中心',
  layout: 'layout-side',
  theme: 'theme-dark',
  collapsed: false,
  showLogo: true,
  sideWidth: 250,
  tabType: 'pear-dot-tab',
  color: '#2d8cf0',
  colorList: ['#2d8cf0', 'rgb(255,184,0)', 'rgb(255,87,34)', '#36b368', 'black', 'gray'],
  routerAnimate: 'fade-top',
  routerActive: true,
  uploadAction: import.meta.env.VITE_BASE_URL + 'api/upload',
  multiUploadAction: import.meta.env.VITE_BASE_URL + 'api/uploads',
  imageUrl: (url: string) => {
    if (url.substring(0, 4) === 'http') {
      return url
    }
    return imageBaseUrl + url
  },
  fileUrl: (url: string) => {
    if (url.substring(0, 4) === 'http') {
      return url
    }
    return imageBaseUrl + url
  },
  videoUrl: (url: string) => {
    if (url.substring(0, 4) === 'http') {
      return url
    }
    return imageBaseUrl + url
  },
  pageSizes: [10, 15, 30, 50],
  pageLimit: import.meta.env.VITE_PAGE_LIMIT || 10,
  WhiteList: ['login', 'errors/401', 'errors/404', 'errors/500'],
  methods: ['get', 'post', 'put', 'delete'],

  menus
}
